package com.itheima.chapter09.io.bytestream;

import java.io.FileOutputStream;
import java.io.IOException;

//字节流写数据+try...catch
public class OutputDemo4 {
    public static void main(String[] args) {
        FileOutputStream fos =null;
        try {
            fos= new FileOutputStream("MyIdeaTest\\aaa\\a.txt");
            fos.write(97);
            //fos.close();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            //finally语句中的代码，一定被执行
            if (fos!=null){
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
